<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1">
	<div class="pageMain">
		<div class="pageTitle"><%=MessageResourcesUtils.getMessage(request, "systemmanage.servicemanagement.title") %><span></span>
		<%=MessageResourcesUtils.getMessage(request, "servicemessage.services.ordermessage.title1") %><span></span>
		<%=MessageResourcesUtils.getMessage(request, "servicemessage.services.ordermessage.title2") %>
		</div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "dailyoperation.storechargemanage.storename") %></label>
						<span><input type="text" id="name" name="name" value="" class="validate[required,maxSize[50]]"/></span>
					</li>
				</ul>
				<ul>
					<li>
						<i></i>
						<label>
							<%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.orderpaydate")%>&nbsp;&nbsp;
							<%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.startdate")%>
						</label>
						<span><input type="text" id="startdate" name="startdate" value=""/></span>
					</li>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.enddate")%></label>
						<span><input type="text" id="enddate" name="enddate" value=""/></span>
					</li>
				</ul>
			</div>	
		</div>
		<div class="button-group">
			<input type="hidden" id="storeid" name="storeid" value="" />
			<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request, "common.button.query") %>" />
		</div>
		<table width="100%">
			<tbody>
				<tr>
					<td>
						<table id="datagrid"></table>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</form>
<script type="text/javascript">
function query_datagrid(){
	$('#datagrid').issdatagrid({
		formid : 'form1',
		title : '<%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.list")%>',
		width : 'auto',
		nowrap : true,
		autoRowHeight : false,
		singleSelect : false,
		striped : true,
		url : '${systemctx}/dailyoperation/servicemanage/queryOrderMessageListInfoDataGrid.json',
		sortName: 'modifytime',
		sortOrder: 'desc',
		remoteSort : true,
		idField : 'id',
		pagination : true,
		rownumbers : true,
		showFooter : true,
		queryParams:$('#form1').serializeObject(),
		columns : [[ 
			 {field :'id',title : '<%=MessageResourcesUtils.getMessage(request, "common.button.operation") %>',width :150,align : 'center',
				 formatter:function(value,row,index){
					 return "<a href=\"javascript:void(0);\" class=\"easyui-linkbutton\" onclick=\"servicemanageupdate('"+row.id+"','"+row.storeid+"')\"><%=MessageResourcesUtils.getMessage(request, "common.button.update") %></a>"+
					   		"<a disabled=\"disabled\" class=\"easyui-linkbutton\"><%=MessageResourcesUtils.getMessage(request, "common.button.refund") %></a>"+	   
					   		"<a href=\"javascript:void(0);\" class=\"easyui-linkbutton\" onclick=\"servicemanagedelete('"+row.id+"','"+row.storeid+"')\"><%=MessageResourcesUtils.getMessage(request, "common.button.delete") %></a>";
				 }
			 },
             {title : '<%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.ordercode")%>',field : 'transcode',sortable : true,align : 'left',width:180,
            	formatter: function(value,row,index){
				  return "<a href=\"javascript:void(0);\" onclick=\"view('"+row.id+"','"+row.storeid+"')\">"+value+"</a>";
	       	  	}
	         }, 
             {title : '<%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.paydate")%>',field : 'transtime',sortable : true,align : 'center',width:180},	             
             {title : '<%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.payamount")%>',field : 'amount',sortable : true,align : 'right',width:150},
             {title : '<%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.refundamount")%>',field : 'refundamount',sortable : true,align : 'right',width:150},
             {title : '<%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.buyname")%>',field : 'buyname',sortable : true,align : 'right',width:80},
             {title : '<%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.usestatus")%>',field : 'usestatusname',sortable : true,align : 'right',width:60},
             {title : '<%=MessageResourcesUtils.getMessage(request,"servicemessage.services.ordermessage.inputusername")%>',field : 'inputusername',sortable : true,align : 'right',width:80},
             {field : 'storeid',hidden : true}
           ]],
		onLoadSuccess : function(data) {

		}
	});
}
function servicemanageupdate(id,storeid){
	$(this).isswindow({
		title : '<%=MessageResourcesUtils.getMessage(request, "servicemessage.services.ordermessage.view.title") %>',
		noheader : true,
		url : '${systemctx}/dailyoperation/servicemanage/serviceBuyModify.web?applyId='+id+'&storeid='+storeid
	});
}
function servicemanagerefund(id,storeid){
	alert(JSON.stringify(row));
}
function servicemanagedelete(id,storeid){
	if(confirm('<%=MessageResourcesUtils.getMessage(request,"common.message.alert")%>')){
		showSending();
		$.ajax({
			type : 'GET',
			url : '${systemctx}/dailyoperation/servicemanage/deleteServiceBuy.json?mainid='+id+"&storeid="+storeid,
			dataType : 'json',
			success : function(data) {
				//显示AJAX请求后的提示信息
				closeSending();
				alert(data.message);
				query_datagrid();
			}
		});
	}
}
$(document).ready(function(){
	$('#startdate').date_input();
	$('#enddate').date_input();
	$("#name").issNewMagnifier({
		title: '<%=MessageResourcesUtils.getMessage(request, "systemmanage.databasebinding.storemagnifiertitle") %>',
		url: '${systemctx}/publicMagnifier/publicMagnifier.json',
		sortName : 'modifytime',
		sortOrder : 'desc',
		linkName: 'number',
		callSqlKey: 'queryStoreMagnifierSql',
		changeIgnore: ['name'],
		columns: [[
				{title:'<%=MessageResourcesUtils.getMessage(request, "dailyoperation.store.column.number") %>', field:'number', width:180, sortable:true, align: 'left'},
				{title:'<%=MessageResourcesUtils.getMessage(request, "dailyoperation.store.column.name") %>', field:'name', sortable:true, align: 'left', formel:'name'},
				{field:'id',hidden:true,formel:'storeid'}
		]],
		onBeforeOpen:function(p){
	      var queryParams = {
	    		  querystore: '%' + $("#name").val() + '%',
	    		  statusid: <%=SysConstant.RecordStatus.VALID %>,
	    		  state : <%=SysConstant.CommonApproveStatus.OK %>
	      };
	      return queryParams;
	    }
	});
	
	$('#butQuery').click(function(){
		var id = $('#storeid').val();
		if(id ==''){
			alert('<%=MessageResourcesUtils.getMessage(request, "alertinfo.servicemanage.alert1") %>')
		}else{
			query_datagrid();
		}
	});
					
});
function view(id,storeid){
	$(this).isswindow({
		title : '<%=MessageResourcesUtils.getMessage(request, "servicemessage.services.ordermessage.view.title") %>',
		noheader : true,
		url : '${systemctx}/dailyoperation/servicemanage/serviceBuyView.web?applyId='+id+'&storeid='+storeid
	});
}
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>